<?php
namespace Components\Account\User\Wallet\Log;

class Service {
  private static $constants = [
    'type' => [
      'value' => [
        11 => ['disabled'=>true,'name' => '充值'],
        12 => ['disabled'=>true,'name' => '提现'],
        21 => ['disabled'=>true,'name' => '买入'],
        22 => ['disabled'=>true,'name' => '卖出'],
        31 => ['disabled'=>true,'name' => '转入'],
        32 => ['disabled'=>true,'name' => '转出'],
        5  => ['disabled'=>true,'name' => '使用'],
        51 => ['disabled'=>true,'name' => '注册用户'],
        52 => ['disabled'=>true,'name' => '重复消费'],
        8  => ['disabled'=>false,'name'=> '奖'], 
        82 => ['disabled'=>true,'name'=> '层碰奖'], 
        83 => ['disabled'=>true,'name'=> '对碰奖'], 
        84 => ['disabled'=>true,'name'=> '见点奖'], 
        85 => ['disabled'=>true,'name'=> '分红奖'], 
        86 => ['disabled'=>true,'name'=> '店代理奖'], 
        87 => ['disabled'=>true,'name'=> '重消奖']
      ]
    ],
    'active' => [
      'value' => [
				0 => ['disabled'=>true,'name'=>'减','symbol'=>'-'],
				1 => ['disabled'=>true,'name'=>'加','symbol'=>'+']
			]
    ]
  ];

	public static function getConstants($key = null) {
		if(is_null($key)) { return static::$constants; }
		if(isset(static::$constants[$key])) { return static::$constants[$key]; }
		return null;
	}
	
  public function getModelClassNameByField($field) {
    switch($field) {
      case 1:
      case '1':
        return ['code'=>0,'name'=>'货','key'=>'Goods','field'=>'goods','class_name'=>GoodsLogModel::class];
      case 2:
      case '2':
        return ['code'=>0,'name'=>'报单币','field'=>'declaration_coin','class_name'=>DeclarationCoinLogModel::class];
      case 3:
      case '3':
        return ['code'=>0,'name'=>'旅游积分','field'=>'tourism_integration','class_name'=>TourismIntegrationLogModel::class];
      case 4:
      case '4':
        return ['code'=>0,'name'=>'购物券','field'=>'coupon','class_name'=>CouponLogModel::class];
      case 5:
      case '5':
        return ['code'=>0,'name'=>'激活码','field'=>'activation_code','class_name'=>ActivationCodeLogModel::class];
      default:
        return ['code'=>-1,'message'=>'此钱包日志字段不存在'];
    }
  }
}